/**
 * Created by user on 2018/3/28.
 */
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { MainAction } from '../actions'
import {getEleInnerHtml} from '../utils/Global'

class QuitPcMask extends Component {
  clickBtn = () => {
    const { dispatch } = this.props
    dispatch({type: 'RESET_GLOBAL_STATE'})
    // return
    // const { changeScreen, toggleQuitPc } = MainAction
    // dispatch(toggleQuitPc(false))
    // dispatch(changeScreen(-1))
  }
  render() {
    const { showQuitPc } = this.props
    const isTntm = getEleInnerHtml('tntmArea')
    return showQuitPc ? (
      <div className="quit_pc_mask">
        <div className="quit_pc_mask_inner">
          <img className="quit_pc_image" src={require('../images/other_login_icon.png')} alt=""/>
          <div className="quit_pc_text">{isTntm ? '您已退出登陆' : '您已经退出PC端'}</div>
          <div onClick={this.clickBtn} className="quit_pc_btn">{isTntm ? '返回重新登录' : '我知道了'}</div>
        </div>
      </div>
    ) : null
  }
}

const mapStateToProps = (state) => {
  return {
    showQuitPc: state.MainScreenState.showQuitPc
  }
}

export default connect(mapStateToProps)(QuitPcMask)
